package com.flycms.module.agent;

import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

/**
 * @author huangzt
 * @version 1.0
 * @date 2020/3/1 19:11
 */
public class VisitPersonRowMapper implements RowMapper<VisitPersonVo> {
    @Override
    public VisitPersonVo mapRow(ResultSet resultSet, int i) throws SQLException {
        //获取结果集中的数据
        Integer id = resultSet.getInt("id");
        String agent = resultSet.getString("agent");
        String ip = resultSet.getString("ip");
        Date time = resultSet.getDate("time");
        //把数据封装成VisitPersonVo对象
        VisitPersonVo visitor = new VisitPersonVo();
        visitor.setId(id);
        visitor.setAgent(agent);
        visitor.setIp(ip);
        visitor.setTime(time);
        return visitor;
    }
}
